package com.alibaba.ai.controller;

import com.alibaba.ai.entity.YUsers;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class YUserController {
    @Resource
    private com.alibaba.ai.service.YUserService YUserService;

    @ResponseBody
    @RequestMapping("/demo")
    public List<YUsers> demo() {
        List<YUsers> listUser = YUserService.demo();
        for (YUsers YUsers : listUser) {
            System.out.println(listUser);
        }
        return listUser;
    }

    @ResponseBody
    @RequestMapping("/getUserListByCount")
    public List<YUsers> getUserListByCount() {
        List<YUsers> listUser = YUserService.getUserListByCount();
        for (YUsers YUsers : listUser) {
            System.out.println(YUsers);
        }
        return listUser;
    }

    @ResponseBody
    @RequestMapping("/getUserByUserId")
    public List<JSONObject> getUserList(Integer yUsersId) {

        List<JSONObject> listUser = YUserService.getUserByUserId(yUsersId);
        for (JSONObject YUser : listUser) {
            System.out.println(YUser);
        }

        return listUser;
    }

    //个人信息页面——————等级——他的等级
    @ResponseBody
    @RequestMapping("/getUserRankByUserId")
    public List<JSONObject> getUserRankByUserId(Integer yUsersId) {

        List<JSONObject> listUser = YUserService.getUserRankByUserId(yUsersId);
        for (JSONObject YUser : listUser) {
            System.out.println(YUser);
        }

        return listUser;
    }


    //个人信息页面——————财富
    @ResponseBody
    @RequestMapping("/getUserMoneyByUserId")
    public List<JSONObject> getUserMoneyByUserId(Integer yUsersId) {

        List<JSONObject> listUser = YUserService.getUserMoneyByUserId(yUsersId);
        for (JSONObject YUser : listUser) {
            System.out.println(YUser);
        }

        return listUser;
    }
    
}